function* yeidfunc(){
  yield a()
  yield b()
  const res = yield c()
  console.log('xxxxxx',res)
  yield d(res)
  console.log('结束')
}

function a(){
  setTimeout(() => {
    console.log('c','1')
  }, 2000);
}

function b(){
 return new Promise((resolve,reject)=>{
    setTimeout(() => {
        console.log('b','2')
        resolve()
    }, 1000);
  })
}

function c(){
  return new Promise((resolve,reject)=>{
    setTimeout(() => {
        console.log('b','2')
        resolve(222)
    }, 1000);
  })
}
console.log(c())

function d(a){
    console.log('d',a)
}
var g = yeidfunc()
for(let i =0; i<4;i++){
  console.log(g.next())
}
// g.next()
// g.next()
// g.next()
// g.next()